package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PackageInfo;
import com.ruoyi.system.service.IPackageInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2025-02-20
 */
@RestController
@Api(tags = "【PackageInfo】")
@RequestMapping("/system/PackageInfo")
public class PackageInfoController extends BaseController
{
    @Autowired
    private IPackageInfoService packageInfoService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    @ApiOperation(value = "【PackageInfo】列表")
    public TableDataInfo list(@RequestBody PackageInfo packageInfo, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize)
    {
        List<PackageInfo> list = packageInfoService.selectPackageInfoList(packageInfo, pageNum, pageSize);
        Long total = packageInfoService.selectOrderqaInfoCount(packageInfo);
        return getDataTable(list, total);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "【PackageInfo】导出")
    public void export(HttpServletResponse response, PackageInfo packageInfo)
    {
        List<PackageInfo> list = packageInfoService.selectPackageInfoAll(packageInfo);
        ExcelUtil<PackageInfo> util = new ExcelUtil<PackageInfo>(PackageInfo.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "【PackageInfo】详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(packageInfoService.selectPackageInfoById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation(value = "新增")
    public AjaxResult add(@RequestBody PackageInfo packageInfo)
    {
        return toAjax(packageInfoService.insertPackageInfo(packageInfo));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    @ApiOperation(value = "修改")
    public AjaxResult edit(@RequestBody PackageInfo packageInfo)
    {
        return toAjax(packageInfoService.updatePackageInfo(packageInfo));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation(value = "删除")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(packageInfoService.deletePackageInfoByIds(ids));
    }
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/selectPackageInfoAll")
    @ApiOperation(value = "查询物料包装皮重")
    public AjaxResult selectPackageInfoAll()
    {
        List<PackageInfo> list = packageInfoService.selectPackageInfoAll();
        return success(list);
    }

}
